/*
 * @Author: wangc
 * @Date: 2020-07-28 19:26:51
 * @LastEditTime: 2020-08-29 21:27:43
 * @Description: 
 */
import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/pc/Login.vue'
Vue.use(VueRouter)

// 解决Vue-Router升级导致的Uncaught(in promise) navigation guard问题
const originalPush = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace(location, onResolve, onReject) {
    if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
    return originalPush.call(this, location).catch(err => err)
}
const routes = [{
        path: '/',
        name: 'Login',
        component: Login,
    },
    {
        path: '/login',
        name: 'Login',
        component: Login,
        meta: {
            isLogin: false
        }
    }
]

const router = new VueRouter({
    mode: 'history',
    routes
})
export default router